<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>区块链网络中矿池选择的演化博弈 | Ywrby个人博客网站</title><meta name="keywords" content="区块链,演化博弈"><meta name="author" content="Ywrby"><meta name="copyright" content="Ywrby"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="区块链网络中矿池选择的演化博弈论文原文链接: Evolutionary Game for Mining Pool Selection in Blockchain Networks Abstract在基于工作量证明（POW）的区块链网络中，区块矿工参与解决加密难题的竞赛，以赢得发布（即挖掘）新区块的奖励。由于加密难题的显著难度，个体矿工倾向于加入矿池以确保稳定的利润。我们研究了区块链网络中矿池选择的">
<meta property="og:type" content="article">
<meta property="og:title" content="区块链网络中矿池选择的演化博弈">
<meta property="og:url" content="http://ywrby.cn/2021/11/14/%E5%8C%BA%E5%9D%97%E9%93%BE%E7%BD%91%E7%BB%9C%E4%B8%AD%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/index.html">
<meta property="og:site_name" content="Ywrby个人博客网站">
<meta property="og:description" content="区块链网络中矿池选择的演化博弈论文原文链接: Evolutionary Game for Mining Pool Selection in Blockchain Networks Abstract在基于工作量证明（POW）的区块链网络中，区块矿工参与解决加密难题的竞赛，以赢得发布（即挖掘）新区块的奖励。由于加密难题的显著难度，个体矿工倾向于加入矿池以确保稳定的利润。我们研究了区块链网络中矿池选择的">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="http://ywrby.cn/img/73143110_p0.jpg">
<meta property="article:published_time" content="2021-11-14T12:53:03.000Z">
<meta property="article:modified_time" content="2021-12-08T07:43:29.298Z">
<meta property="article:author" content="Ywrby">
<meta property="article:tag" content="区块链">
<meta property="article:tag" content="演化博弈">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://ywrby.cn/img/73143110_p0.jpg"><link rel="shortcut icon" href="/img/title.png"><link rel="canonical" href="http://ywrby.cn/2021/11/14/%E5%8C%BA%E5%9D%97%E9%93%BE%E7%BD%91%E7%BB%9C%E4%B8%AD%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"We didn't find any results for the search: ${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '区块链网络中矿池选择的演化博弈',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-12-08 15:43:29'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    document.addEventListener('pjax:complete', detectApple)})(window)</script><link rel="stylesheet" href="/css/background.css"><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="Ywrby个人博客网站" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/ywrby.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">127</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">22</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Bilibili</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/bangumis/"><i class="fa-fw fas fa-video"></i><span> 追番列表</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://space.bilibili.com/353923033"><i class="fa-fw fas fa-music"></i><span> B站主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/73143110_p0.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Ywrby个人博客网站</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> Search</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> Bilibili</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/bangumis/"><i class="fa-fw fas fa-video"></i><span> 追番列表</span></a></li><li><a class="site-page child" target="_blank" rel="noopener" href="https://space.bilibili.com/353923033"><i class="fa-fw fas fa-music"></i><span> B站主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">区块链网络中矿池选择的演化博弈</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-11-14T12:53:03.000Z" title="Created 2021-11-14 20:53:03">2021-11-14</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2021-12-08T07:43:29.298Z" title="Updated 2021-12-08 15:43:29">2021-12-08</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="区块链网络中矿池选择的演化博弈"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="区块链网络中矿池选择的演化博弈"><a href="#区块链网络中矿池选择的演化博弈" class="headerlink" title="区块链网络中矿池选择的演化博弈"></a>区块链网络中矿池选择的演化博弈</h1><p><a target="_blank" rel="noopener" href="https://ieeexplore.ieee.org/abstract/document/8326513">论文原文链接: Evolutionary Game for Mining Pool Selection in Blockchain Networks</a></p>
<h2 id="Abstract"><a href="#Abstract" class="headerlink" title="Abstract"></a>Abstract</h2><p>在基于工作量证明（POW）的区块链网络中，区块矿工参与解决加密难题的竞赛，以赢得发布（即挖掘）新区块的奖励。由于加密难题的显著难度，个体矿工倾向于加入矿池以确保稳定的利润。我们研究了区块链网络中矿池选择的动态，其中矿池可以选择任意块挖掘策略（<a href="#%E6%8C%96%E6%8E%98%E7%AD%96%E7%95%A5">补充</a>）。我们将解谜的哈希率和区块传播延迟确定为决定挖矿竞争结果的两个主要因素。然后我们将个体矿工的策略演化建模为演化博弈。我们提供了两个池情况下池选择动力学中演化稳定性的理论分析。数值模拟支持我们的理论发现，并证明了一般情况下矿工策略演变的稳定性</p>
<h2 id="Section1-Introduction"><a href="#Section1-Introduction" class="headerlink" title="Section1-Introduction"></a>Section1-Introduction</h2><p>公共区块链网络构建为覆盖点对点 (P2P) 网络，用于去中心化防篡改数据记录。中本聪共识协议 用于在利益角度上激励全节点（区块矿工）遵守区块链状态维护的“最长链规则”。遵循该协议，区块矿工将一组任意经过验证的交易打包成一个数据结构，称为候选“区块”，并将其广播到整个网络。区块链状态被维护为由散列指针以松散同步的方式链接的块的线性列表。即，矿工始终将观察到的最长链作为其本地区块链副本。</p>
<p>中本聪协议的激励机制由两部分组成：</p>
<ol>
<li>一个计算密集型的加密难题解决过程</li>
<li>一个奖励确认过程，用于在矿工发布的区块被网络认可时向矿工提供奖励</li>
</ol>
<p>密码谜题解决过程是通过工作量证明 (PoW) 竞赛实现的，其中矿工详尽地查询可信随机预言机，例如 SHA-256 哈希函数，以找到满足原像的随机字符串条件基于他们自己的区块提议。在奖励过程中，首先在网络上传播其候选区块的矿工因其在验证新交易方面的努力而获得数字代币奖励。与移动网络中流行的激励机制相比，中本聪协议的特点是在其区块确认功能中嵌入了去中心化的代币发行方案。在每个区块固定奖励的情况下，节点加入共识过程的意愿主要受能源消耗预期成本的影响。</p>
<p>赢得 PoW 竞赛的概率取决于矿工的哈希率（即矿工每秒对哈希函数的查询次数）与整个网络的总哈希率之间的比率。同时，P2P网络中的区块传播时间决定了一个共识回合内区块确认的最终结果，因为只有传播到大多数节点的第一个区块才会被接受为区块链的新头。实际上，由于网络中压倒性的哈希率，单个矿工赢得 PoW 竞赛的机会可以忽略不计。因此，现实世界的区块链网络由代表矿工联盟的代理节点主导，这些节点被称为矿池。矿池作为任务调度器，将原像搜索任务划分为更小的子任务，并根据矿工的投入/报告哈希率将它们分配给矿池中的矿工。通过聚合许多矿工的哈希率，矿池赢得区块奖励的概率变得非常大。然后，单个矿工可以根据其在池中的哈希率份额来确保其少量但稳定的奖励份额。</p>
<p>在这篇论文中，我们研究了基于 PoW 的区块链网络中的矿池选择问题。我们认为个体矿工是有限理性的，矿池采用任意的挖掘策略。我们将网络中的池选择动态建模为演化博弈模型。我们关注哈希率和传播延迟对策略演化的影响，并研究了两个矿池情况下矿池选择动态的演化稳定性。</p>
<h2 id="Section2-Problem-Formulation"><a href="#Section2-Problem-Formulation" class="headerlink" title="Section2-Problem Formulation"></a>Section2-Problem Formulation</h2><h3 id="涉及参数"><a href="#涉及参数" class="headerlink" title="涉及参数"></a>涉及参数</h3><ul>
<li>$$N: 区块链网络中独立矿工数量$$</li>
<li>$$M: 区块链网络中独立矿工形成的矿池数量$$</li>
<li>$$\mathcal {M}：所有矿池的集合$$</li>
<li>$$\omega _{i}: 矿池i要求每个独立矿工提供的哈希率$$</li>
<li>$$\pmb {\omega }: 所有矿池要求每个独立矿工提供的哈希率集合$$</li>
<li>$$x_{i}: 矿池i中矿工人数占总人数比例$$</li>
<li>$$\mathbf {x}: 各个矿池中矿工人数占总人数比例的集合$$</li>
<li>$${\Pr }^{\textrm {mine}}_{i}(\mathbf {x},\pmb {\omega }): 矿池i赢得挖矿竞赛的概率$$</li>
<li>$$s: 区块大小$$</li>
<li>$$\gamma: 网络规模相关参数$$</li>
<li>$$c: 每个链路平均有效信道容量$$</li>
<li>$$\tau _{p}(s): 大小为s的块的传输延迟时间$$</li>
<li>$$\beta: 由网络规模和每个节点的平均验证速度共同决定的参数$$</li>
<li>$$\tau _{v}(s): 验证大小为s的块所需的时间$$</li>
<li>$${\Pr }^{\textrm {orphan}}(s): 孤立大小为 s 的有效块的概率$$</li>
<li>$${\Pr }^{\textrm {win}}_{i}(\mathbf {x}, \pmb {\omega }, si): 矿池 i 最终赢得一个大小为si的区块的挖矿竞赛的概率是$$</li>
<li>$$R: 代币发行的奖励$$</li>
<li>$$\rho: 每单位数据大小的交易确认价格$$</li>
<li>$$\rho s_{i}: 区块交易的手续费$$</li>
<li>$$p: 在 T 期间维持单位哈希率的能源价格$$</li>
<li>$$p\omega _{i}: 能量成本$$</li>
<li>$$y_{i}(\mathbf {x}, \pmb {\omega }, s_{i}): 矿工在矿池 i 中的期望收益$$</li>
</ul>
<h3 id="A-利用POW机制进行挖矿的矿工收益计算"><a href="#A-利用POW机制进行挖矿的矿工收益计算" class="headerlink" title="A.利用POW机制进行挖矿的矿工收益计算"></a>A.利用POW机制进行挖矿的矿工收益计算</h3><p>现假设有一个基于POW的区块链网络，其中有N个独立矿工，这些矿工自行组织成M个矿池，这些矿池的集合可以表示为$$\mathcal {M}={1, 2, \ldots, M}$$，我们假设解谜过程是<a href="#%E6%8A%97asic">抗ASIC</a>的，换句话说，矿工使用通用计算单元进行哈希查询，并且具有大致相同的哈希效率，即每瓦特的哈希率。矿池i要求<strong>每个</strong>加入矿池的矿工提供一定的哈希率<br>$$\omega _{i}$$</p>
<p>$$\pmb {\omega }=[\omega _{1},\ldots, \omega _{M}]^{\top }$$</p>
<p>表示所有矿池要求每个独立矿工提供的哈希率集合，另外，让</p>
<p>$$\mathbf {x}=[x_{1},\ldots,x_{M}]^{\top }$$</p>
<p>表示矿池中矿工人数占总体矿工数的比例，即</p>
<p>$$\mathcal {X}=\left&lt;!–swig￼1–&gt; x_{i}=1}\right}$$</p>
<p><img src="https://ywrbyimg.oss-cn-chengdu.aliyuncs.com/img/QQ%E6%88%AA%E5%9B%BE20211208153315.png"></p>
<p>综上所述，矿池i赢得挖矿竞赛的概率为：</p>
<p>$${\Pr }^{\textrm {mine}}_{i}(\mathbf {x},\pmb {\omega })=\frac {\omega <em>{i} x</em>{i}}{\sum _{j=1}^{M}\omega <em>{j} x</em>{j}}$$</p>
<p><img src="https://ywrbyimg.oss-cn-chengdu.aliyuncs.com/img/QQ%E6%88%AA%E5%9B%BE20211208153412.png"></p>
<p>矿池 i 向所有P2P网络中的对等方广播一个成功开采的区块，以将其传播到整个网络。区块传播时间由每条链路上的传输延迟和每个中继节点的交易验证时间决定。对于大小为s的块，传输延迟可以建模为</p>
<p>$$\tau _{p}(s)=\frac {s}{\gamma c}$$</p>
<p>其中</p>
<p>$$\gamma$$</p>
<p>表示网络规模相关参数，c是每个链路的平均有效信道容量。同时，由于验证一笔交易需要固定的计算量，区块验证时间可以建模为线性函数</p>
<p>$$\tau _{v}(s)=\beta s$$</p>
<p>其中</p>
<p>$$\beta$$</p>
<p>是由网络规模和每个节点的平均验证速度共同决定的参数.然后，大小为 s 的块在网络中传播的平均时间为:</p>
<p>$$ \tau (s)=\tau _{p}(s)+\tau _{v}(s)=\frac {s}{\gamma c}+\beta s. $$</p>
<p>由于传播延迟而放弃（即孤立）有效候选块的发生率遵循泊松过程(<a href="#%E5%AD%A4%E7%AB%8B%E5%9D%97">补充</a>)，平均速率为 1/T，由网络维持为固定的平均挖掘速率。因此，孤立大小为 s 的有效块的概率为：</p>
<p>$${\Pr }^{\textrm {orphan}}(s)=1-e^{-\tau (s)/T}=1-e^{-\left({\frac {s}{\gamma c}+\beta s}\right) /T}.$$</p>
<p>所以，然后，矿池 i 最终赢得一个大小为 </p>
<p>$$s_{i}$$ </p>
<p>的区块的挖矿竞赛的概率是 ( 赢得竞赛的概率乘挖到的区块不被孤立的概率 ) ：</p>
<p>$${\Pr }^{\textrm {win}}<em>{i}(\mathbf {x}, \pmb {\omega }, s</em>{i})=(1-{\Pr }^{\textrm {orphan}}(s))*{\Pr }^{\textrm {mine}}<em>{i}(\mathbf {x},\pmb {\omega })=\frac {\omega <em>{i} x</em>{i}}{\sum <em>{j=1}^{M}\omega <em>{j} x</em>{j}} e^{-\left({\frac {s</em>{i}}{\gamma c}+\beta s</em>{i}}\right)/T}.$$</p>
<p><img src="https://ywrbyimg.oss-cn-chengdu.aliyuncs.com/img/QQ%E6%88%AA%E5%9B%BE20211208153637.png"></p>
<p>一个区块的收益由固定的代币发行奖励和打包在新区块中的所有交易的交易费用组成。考虑到区块链用户为每笔交易支付固定费用并且交易记录具有相同的大小。令 R 表示代币发行奖励，</p>
<p>$$\rho$$ </p>
<p>表示每单位数据大小的交易确认价格。然后，交易费用可以表示为</p>
<p> $$\rho s_{i}$$</p>
<p> 由于哈希计算，矿工还必须考虑能源成本。让 p 表示在 T 期间维持单位哈希率的能源价格。能量成本可以表示为</p>
<p>$$p\omega _{i}$$</p>
<p>  结合之前的讨论，矿工在矿池 i 中的期望收益可以表示为</p>
<p>$$y_{i}(\mathbf {x}, \pmb {\omega }, s_{i})=\frac {R+\rho s_{i}}{N x_{i}}\frac {\omega <em>{i} x</em>{i}}{\sum <em>{j=1}^{M}\omega <em>{j} x</em>{j}} e^{-\left({\frac {s</em>{i}}{\gamma c}+\beta s_{i}}\right)/T}-p\omega _{i}.\qquad $$</p>
<p><img src="https://ywrbyimg.oss-cn-chengdu.aliyuncs.com/img/QQ%E6%88%AA%E5%9B%BE20211208153743.png"></p>
<h3 id="B-矿池选择过程中的演化博弈"><a href="#B-矿池选择过程中的演化博弈" class="headerlink" title="B.矿池选择过程中的演化博弈"></a>B.矿池选择过程中的演化博弈</h3><p>考虑到每个矿工都是有限理性的，并且旨在最大化其个体的收益。所以我们可以将矿池选择过程中的演化博弈定义为一个四元组：</p>
<p>$$\mathcal {G}=\langle \mathcal {N}, \mathcal {M}, \mathbf {x}, {y_{i}(\mathbf {x}, \pmb {\omega }, s_{i})}_{i\in \mathcal {M}} \rangle$$</p>
<ul>
<li>$$其中\mathcal {N}表示个体矿工人数,并且\vert \mathcal {N}\vert =N$$</li>
<li>$$\mathcal {M}={1, 2, \ldots, M}表示所有矿池的集合$$</li>
<li>$$\mathbf {x}\in \mathcal {X}表示人口状态向量$$</li>
<li>$${y_{i}(\mathbf {x}, \pmb {\omega }, s_{i})}_{i\in \mathcal {M}}表示每个矿池中单个矿工收益的集合$$</li>
</ul>
<p>最后，根据成对比例模仿协议，我们完成了矿池选择过程中的演化博弈过程</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">初始化阶段</span></span><br><span class="line"><span class="comment">1. 所有矿工i堆积选择一个矿池加入</span></span><br><span class="line"><span class="comment">2. 初始化t为1</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="keyword">while</span> x has <span class="keyword">not</span> converged <span class="keyword">and</span> t&lt;MAX_COUNTER <span class="keyword">do</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">for</span> i∈N <span class="keyword">do</span></span><br><span class="line"></span><br><span class="line">j ← Rand(<span class="number">1</span>,M) &#123;Randomly selects a pool j∈M &#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//Determine whether to switch to pool j according to the switching probability</span></span><br><span class="line"><span class="comment">//根据转换概率公式（下文给出）决定是否切换矿池</span></span><br><span class="line"><span class="function">Function <span class="title">switching_probability</span><span class="params">()</span></span>;</span><br><span class="line"></span><br><span class="line">end <span class="keyword">for</span></span><br><span class="line"></span><br><span class="line">t=t+<span class="number">1</span></span><br><span class="line"></span><br><span class="line">end <span class="keyword">while</span></span><br></pre></td></tr></table></figure>

<p>转换概率公式：</p>
<p>$$\rho <em>{i,j}=x</em>{j}\max (y_{j}(\mathbf {x}, \pmb {\omega }, s_{j}) - y_{i}(\mathbf {x}, \pmb {\omega }, s_{i}), 0)$$</p>
<p><img src="https://ywrbyimg.oss-cn-chengdu.aliyuncs.com/img/QQ%E6%88%AA%E5%9B%BE20211208153807.png"></p>
<h2 id="仿真过程"><a href="#仿真过程" class="headerlink" title="仿真过程"></a>仿真过程</h2><h2 id="补充知识"><a href="#补充知识" class="headerlink" title="补充知识"></a>补充知识</h2><h3 id="挖掘策略"><a href="#挖掘策略" class="headerlink" title="挖掘策略"></a>挖掘策略</h3><p>挖掘策略：指矿工在解谜过程以及最后公布区块阶段采取的相应策略，旨在通过合法的方式增大自己的收益，常见的挖掘策略有自私挖掘与合作挖掘，从而还衍生出了智能矿工的概念（不断动态分析各个矿池的数据,可以动态获到当前收益最高的矿池，选择收益最高的矿池）</p>
<p>自私挖掘：自私挖掘主要通过扣留区块，拖延公布区块的时间来达成。- 自私挖矿的目的不是破坏加密货币的区块链网络，而是获得更大利润。</p>
<blockquote>
<p>这种攻击主要由矿工发起。我们以比特币区块链作为例子。简单地说，攻击者挖到新区块后藏起来不公布，其他诚实矿工因为不知道新区块的存在，还是继续在旧区块基础上挖矿。等到攻击者挖到第二枚区块后便会同时公布手中藏着的两枚区块，这时，区块链分叉就出现了。只要攻击者比诚实矿工多挖一枚区块，攻击者所在的分叉就是最长链：根据比特币的共识机制，矿工只在最长链后面挖矿。因此，原本诚实矿工们所在的那条链，因为比攻击者的分叉短，便作废了。此时此刻，攻击者因为挖到了两枚新区块而获得相应收益；而诚实矿工的分叉被废弃，他们什么也得不到。</p>
</blockquote>
<blockquote>
<p>这种攻击的前提是对于算力（即挖矿速度）的比拼。如同刚才提到的，面对区块链出现分叉情况时（这里的分叉不是日常所说改变共识原则的硬分叉或软分叉，而是在共识原则不变前提下的分叉），最长的那一条链被视作合法链。如果自私挖矿攻击者能够迅速让原本的长链变成短链（即在短时间内发布自己挖到的两枚或多枚区块，让自己所在的区块链分叉变成最长链），那么所有诚实守法的矿工所做的努力都白费了。</p>
</blockquote>
<h3 id="抗ASIC"><a href="#抗ASIC" class="headerlink" title="抗ASIC"></a>抗ASIC</h3><p>ASIC是专用继承电路的缩写，是为特定目的而生产的微芯片，在加密货币领域，ASIC最常用于计算密码难题，特别是用于挖矿过程。</p>
<p>顾名思义，抗ASIC是指能够有效抗击ASIC的算法，常见的具有抗ASIC性的货币有以太坊等</p>
<h3 id="孤立块"><a href="#孤立块" class="headerlink" title="孤立块"></a>孤立块</h3><p>孤立块的出现是由于意外分叉，意外分叉即两个或以上的矿工在几乎相同的时间成功挖到区块，此时原来的区块链便会产生分叉，而收到不同区块的两组矿工便会在两条分叉的链上继续挖矿，直至其中一组矿工首先挖到下一枚区块，生成了更长链，此时网络中的矿工便会舍弃原来较短的链上的最后一枚区块，转而相信最长链的数据，分叉也随之消失，而被舍弃的那枚区块，就叫做孤立块。</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">Ywrby</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="http://ywrby.cn/2021/11/14/%E5%8C%BA%E5%9D%97%E9%93%BE%E7%BD%91%E7%BB%9C%E4%B8%AD%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/">http://ywrby.cn/2021/11/14/%E5%8C%BA%E5%9D%97%E9%93%BE%E7%BD%91%E7%BB%9C%E4%B8%AD%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E5%8C%BA%E5%9D%97%E9%93%BE/">区块链</a><a class="post-meta__tags" href="/tags/%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88/">演化博弈</a></div><div class="post_share"><div class="social-share" data-image="/img/73143110_p0.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2021/11/17/18-%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%88%E5%90%B8%E7%83%9F%E8%80%85%EF%BC%8C%E8%AF%BB%E8%80%85-%E5%86%99%E8%80%85%E7%AD%89%EF%BC%89/"><img class="prev-cover" src="/img/73604608_p0.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">18-信号量相关问题（吸烟者，读者-写者等）</div></div></a></div><div class="next-post pull-right"><a href="/2021/11/12/17-%E7%94%9F%E4%BA%A7%E8%80%85%E4%B8%8E%E6%B6%88%E8%B4%B9%E8%80%85%E9%97%AE%E9%A2%98/"><img class="next-cover" src="/img/77593329_p0.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">17-生产者与消费者问题</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/2021/05/15/%E5%9F%BA%E4%BA%8Etio%E5%AE%9E%E7%8E%B0P2P%E7%BD%91%E7%BB%9C/" title="基于tio实现P2P网络"><img class="cover" src="/img/illust_3518827_20191113_165540.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-05-15</div><div class="title">基于tio实现P2P网络</div></div></a></div><div><a href="/2021/05/15/1-%E5%8C%BA%E5%9D%97%E9%93%BE%E5%9F%BA%E7%A1%80%E6%A6%82%E8%BF%B0/" title="1-区块链基础概述"><img class="cover" src="/img/73604608_p0.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-05-15</div><div class="title">1-区块链基础概述</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> Comment</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/ywrby.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Ywrby</div><div class="author-info__description">Students majoring in CS at SWU</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">127</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">22</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/ywrby"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="mailto:ywrby0214@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://space.bilibili.com/353923033" target="_blank" title="Bilibili"><i class="fas fa-file-video"></i></a><a class="social-icon" href="http://wpa.qq.com/msgrd?v=3&amp;uin=2278431384&amp;site=qq&amp;menu=yes" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="https://twitter.com/ywrby1" target="_blank" title="Twitter"><i class="fab fa-twitter"></i></a><a class="social-icon" href="https://www.facebook.com/profile.php?id=100033741068822" target="_blank" title="Facebook"><i class="fab fa-facebook"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>Announcement</span></div><div class="announcement_content">Less is more</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%8C%BA%E5%9D%97%E9%93%BE%E7%BD%91%E7%BB%9C%E4%B8%AD%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88"><span class="toc-number">1.</span> <span class="toc-text">区块链网络中矿池选择的演化博弈</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Abstract"><span class="toc-number">1.1.</span> <span class="toc-text">Abstract</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Section1-Introduction"><span class="toc-number">1.2.</span> <span class="toc-text">Section1-Introduction</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Section2-Problem-Formulation"><span class="toc-number">1.3.</span> <span class="toc-text">Section2-Problem Formulation</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B6%89%E5%8F%8A%E5%8F%82%E6%95%B0"><span class="toc-number">1.3.1.</span> <span class="toc-text">涉及参数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#A-%E5%88%A9%E7%94%A8POW%E6%9C%BA%E5%88%B6%E8%BF%9B%E8%A1%8C%E6%8C%96%E7%9F%BF%E7%9A%84%E7%9F%BF%E5%B7%A5%E6%94%B6%E7%9B%8A%E8%AE%A1%E7%AE%97"><span class="toc-number">1.3.2.</span> <span class="toc-text">A.利用POW机制进行挖矿的矿工收益计算</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#B-%E7%9F%BF%E6%B1%A0%E9%80%89%E6%8B%A9%E8%BF%87%E7%A8%8B%E4%B8%AD%E7%9A%84%E6%BC%94%E5%8C%96%E5%8D%9A%E5%BC%88"><span class="toc-number">1.3.3.</span> <span class="toc-text">B.矿池选择过程中的演化博弈</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BB%BF%E7%9C%9F%E8%BF%87%E7%A8%8B"><span class="toc-number">1.4.</span> <span class="toc-text">仿真过程</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%A1%A5%E5%85%85%E7%9F%A5%E8%AF%86"><span class="toc-number">1.5.</span> <span class="toc-text">补充知识</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8C%96%E6%8E%98%E7%AD%96%E7%95%A5"><span class="toc-number">1.5.1.</span> <span class="toc-text">挖掘策略</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8A%97ASIC"><span class="toc-number">1.5.2.</span> <span class="toc-text">抗ASIC</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AD%A4%E7%AB%8B%E5%9D%97"><span class="toc-number">1.5.3.</span> <span class="toc-text">孤立块</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/12/25/22-%E5%86%85%E5%AD%98%E7%A9%BA%E9%97%B4%E6%89%A9%E5%85%85%EF%BC%88%E8%A6%86%E7%9B%96%E4%B8%8E%E4%BA%A4%E6%8D%A2%EF%BC%89/" title="22-内存空间扩充（覆盖与交换）"><img src="/img/67888138_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="22-内存空间扩充（覆盖与交换）"/></a><div class="content"><a class="title" href="/2021/12/25/22-%E5%86%85%E5%AD%98%E7%A9%BA%E9%97%B4%E6%89%A9%E5%85%85%EF%BC%88%E8%A6%86%E7%9B%96%E4%B8%8E%E4%BA%A4%E6%8D%A2%EF%BC%89/" title="22-内存空间扩充（覆盖与交换）">22-内存空间扩充（覆盖与交换）</a><time datetime="2021-12-25T08:15:49.000Z" title="Created 2021-12-25 16:15:49">2021-12-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/12/19/21-%E5%86%85%E5%AD%98%E4%B8%8E%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="21-内存与内存管理"><img src="/img/80857290_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="21-内存与内存管理"/></a><div class="content"><a class="title" href="/2021/12/19/21-%E5%86%85%E5%AD%98%E4%B8%8E%E5%86%85%E5%AD%98%E7%AE%A1%E7%90%86/" title="21-内存与内存管理">21-内存与内存管理</a><time datetime="2021-12-19T09:57:53.000Z" title="Created 2021-12-19 17:57:53">2021-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/12/11/20-%E6%AD%BB%E9%94%81/" title="20-死锁"><img src="/img/81934649_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="20-死锁"/></a><div class="content"><a class="title" href="/2021/12/11/20-%E6%AD%BB%E9%94%81/" title="20-死锁">20-死锁</a><time datetime="2021-12-11T06:20:20.000Z" title="Created 2021-12-11 14:20:20">2021-12-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/11/28/19-%E7%AE%A1%E7%A8%8B/" title="19-管程"><img src="/img/72581222_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="19-管程"/></a><div class="content"><a class="title" href="/2021/11/28/19-%E7%AE%A1%E7%A8%8B/" title="19-管程">19-管程</a><time datetime="2021-11-28T08:39:08.000Z" title="Created 2021-11-28 16:39:08">2021-11-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/11/17/18-%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%88%E5%90%B8%E7%83%9F%E8%80%85%EF%BC%8C%E8%AF%BB%E8%80%85-%E5%86%99%E8%80%85%E7%AD%89%EF%BC%89/" title="18-信号量相关问题（吸烟者，读者-写者等）"><img src="/img/73604608_p0.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="18-信号量相关问题（吸烟者，读者-写者等）"/></a><div class="content"><a class="title" href="/2021/11/17/18-%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9B%B8%E5%85%B3%E9%97%AE%E9%A2%98%EF%BC%88%E5%90%B8%E7%83%9F%E8%80%85%EF%BC%8C%E8%AF%BB%E8%80%85-%E5%86%99%E8%80%85%E7%AD%89%EF%BC%89/" title="18-信号量相关问题（吸烟者，读者-写者等）">18-信号量相关问题（吸烟者，读者-写者等）</a><time datetime="2021-11-17T12:08:38.000Z" title="Created 2021-11-17 20:08:38">2021-11-17</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/img/73143110_p0.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Ywrby</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="Scroll To Comments"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">Local search</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="Search for Posts" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.2
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
            const target = node.parentNode
            if (target.nodeName.toLowerCase() === 'li') {
              target.parentNode.classList.add('has-jax')
            } else {
              target.classList.add('has-jax')
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"><script src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css"><script>(() => {
  document.querySelectorAll('#article-container span.katex-display').forEach(item => {
    btf.wrap(item, 'div', { class: 'katex-wrap'})
  })
})()</script><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'QkExI1n70lz2qs7pVpmFeKqp-gzGzoHsz',
      appKey: 'WhG61iDj96bflhu6CIpmE9V8',
      placeholder: 'Please leave your footprints',
      avatar: 'mp',
      meta: 'nick,mail,link'.split(','),
      pageSize: '10',
      lang: 'zh-CN',
      recordIP: false,
      serverURLs: '',
      emojiCDN: '',
      emojiMaps: "",
      enableQQ: false,
      path: window.location.pathname,
      requiredFields: ["nick,mail"],
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><div class="aplayer no-destroy" data-id="5402995011" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-lrctype=0	data-order="random" data-preload="none" data-autoplay="true" muted></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config-diff',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.removeEventListener('scroll', window.tocScrollFn)
  window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>